import 'package:dio/dio.dart';
import 'package:shared_preferences/shared_preferences.dart';

void saveCookie(Response response) async {
  final cookies = response.headers['set-cookie'];
  final prefs = await SharedPreferences.getInstance();
  final sessionCookie = cookies?[0].split(';').first; // 获取 session=xxx 部分
  await prefs.setString('cookie', sessionCookie!);
}
